<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer" />
    <title>Case</title>
    <style>
        body {
            position: absolute;
            margin: 0;
            width: 100%;
            height: 100%;
        }

        #mapContainer {
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            float: left;
        }
    </style>
</head>

<body>

    <div id="mapContainer" style="position: relative;">
    </div>

</body>
<script src='/GiswayEngine.js'></script>
<script type="text/javascript">
    window.app = new GE.App('mapContainer', {
        position: [119.69329835650711, 30.55561178489569, 1000],
        lookAt: [119.69329835650711, 30.55561178489569, 0],
        // position: [120.170646, 30.28362, 1000], //相机的位置
        // lookAt: [120.170646, 30.28362, 0], //相机看向的地图位置
        cameraScrollSpeed: 15,
        minZoom: 1,
        maxZoom: 18,
        ambientLightIntensity: 3,
        ambientLightType: 'hemiSphere',
        useCarpet: true,
        // background: "Gradient",
        // backGroundColorA: "#FF0000",
        // backGroundColorb: "#000000",
        useDefaultTexture: true, //是否使用瓦片默认纹理
        baseLayer: [
            {
                // url: 'http://115.236.87.26:8848/googleTiles/china_image/{z}/{y}/{x}.jpg',
                url: ' https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',

                readableUrl: true,
                tileType: 'image',
                canNotSelect: true, //true表示该图层不参与射线拾取，false表示图层参与射线拾取
            },
        ]
    });


    window.app.on('Click', function (e) {
        console.log(e);
        flyTo();
    });

    function flyTo() {
        let cameraPosition = new GE.Point(119.69329835650711, 31.55561178489569, 1000, '4326');
        let lookAtPosition = new GE.Point(119.69329835650711, 31.55561178489569, 0, '4326');
        app.camera.flyTo(cameraPosition, lookAtPosition, 2000);
    }
    fbx();
    btn();
    // EffectBlinkingRing();
    // loadShapeFile();

    function loadShapeFile() {
        let shapeObject = new GE.ShapeObject({
            // url: 'http://localhost:9000/examples/resources/shp/yuhang.shp',
            url: "/examples/resources/shp/53842/53842/109114.shp",
            merge: true
        });
        app.add(shapeObject);
        window.shapeObject = shapeObject;
    }
    function EffectBlinkingRing() {
        let BlinkingRing = new GE.BlinkingRing({
            center: [120.52950010876321, 30.278289949834518, 10],
            radius: 50,
            innerRadius: 25,
            color: '#ff00ff',
            displayOnTop: false,
            speed: 1000
        });
        app.add(BlinkingRing);
    }

    function btn() {
        let button = new GE.Button('测试', function () {
            alert('button click');
        });
        app.ui.add(button);
        window.button = button;

        let button2 = new GE.Button('场景提亮', function () {
            app.light.ambientLight.intensity = 6;
        });
        app.ui.add(button2);
    }


    function fbx() {
        let model = new GE.OverLay({
            type: 'fbx',
            url: '/examples/resources/fbx/xqazm.FBX',
            position: [119.69329835650711, 30.55561178489569, 50],
            // scale: [100, 100, 100],
            // rotation: [45, 0, 0],
            success: function () {
                console.log('fbx loaded!');
            }
        });
        app.add(model);
        window.model = model;
    }

</script>

</html>